<?php

// Getting Theme and Child Theme Data
// Credits: Joern Kretzschmar

$themeData = get_theme_data(TEMPLATEPATH . '/style.css');
$version = trim($themeData['Version']);
if(!$version)
    $version = "unknown";

$ct=get_theme_data(STYLESHEETPATH . '/style.css');
$templateversion = trim($ct['Version']);
if(!$templateversion)
    $templateversion = "unknown";

// set theme constants
define('THEMENAME', $themeData['Title']);
define('THEMEAUTHOR', $themeData['Author']);
define('THEMEURI', $themeData['URI']);
define('THEMATICVERSION', $version);

// set child theme constants
define('TEMPLATENAME', $ct['Title']);
define('TEMPLATEAUTHOR', $ct['Author']);
define('TEMPLATEURI', $ct['URI']);
define('TEMPLATEVERSION', $templateversion);

// Path constants
define('THEMELIB', TEMPLATEPATH . '/library');

// Load classes
require_once(THEMELIB . '/classes/object.php');
require_once(THEMELIB . '/classes/block.php');
require_once(THEMELIB . '/classes/block_extensions.php');

// TODO: Make this a hook so users can hook in other styles
//add_action('wp_head', 'elastic_load_styles');
function elastic_load_styles() {
	$uri = get_template_directory_uri();
	wp_enqueue_style('elastic-structure', $uri . '/structure.css', false, '0.0.0.01');
	wp_enqueue_style('elastic-style', $uri . '/style.css', false, '0.0.0.01');
}


add_action('admin_init','elastic_get_admin');

function elastic_get_admin() {
	global $template;
	$template = 'admin';
	elastic_get_layout();
	$template = 'index';
}

function elastic_get_layout() {
	require(TEMPLATEPATH . '/layout.php');
}

?>